// 8085View.h : interface of the CMy8085View class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_8085VIEW_H__0769A9CE_7890_11D2_8060_00A0C91F41A7__INCLUDED_)
#define AFX_8085VIEW_H__0769A9CE_7890_11D2_8060_00A0C91F41A7__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000


#include "GreenTriangle.h"
#include "crystal/CCrystalEditView.h"

class C8085Display;
class CHelpDialog;
class CMy8085Doc;
class C8085Object;
class CEditPreferences;

class CMy8085View : public CCrystalEditView
{
protected: // create from serialization only
	CMy8085View();
	DECLARE_DYNCREATE(CMy8085View)

// Attributes
public:
	virtual CCrystalTextBuffer *LocateTextBuffer();
	virtual DWORD ParseLine(DWORD dwCookie, int nLineIndex, TEXTBLOCK *pBuf, int &nActualItems);


	CMy8085Doc* GetDocument();
    inline static CMy8085Doc *GetCurrentDoc() 
    {
        return m_pCurrentDoc;
    }
    inline static CMy8085View *GetCurrentView()
    {
        return m_pCurrentView;
    }
    inline static CMDIChildWnd *GetChildFrame()
    {
        return m_pChildFrame;
    }
    static CMy8085Doc*			m_pCurrentDoc;
    static CMy8085View*			m_pCurrentView;
    static CMDIChildWnd*		m_pChildFrame;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMy8085View)
	public:
	//virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
	virtual void OnInitialUpdate();
	//}}AFX_VIRTUAL

// Implementation
public:
	void		RemoveBkPtAtSource( int nSrcLine );
	void		ToggleBkPtAtSource( int nSrcLine );
	void		EnableDisableBkPt(word addr );
	void		EnableDisableBkPtAtSource( int nLine );
	const char* GetAsmHelpText( int nLine );
	void		Set8085DisplayDialogWindowPosition();
	void		ValidateBkPts();
	inline CDebugData& GetDebugObject();
	word		AddressAtCursor();
	word		AddressAtPoint( unsigned int nLine);
	void		StepOver();
	int			Compile();
	void		StatusBarMessage(const CString& );
    void		InitDebugInfo();
	void		ShowCurrentPosition();
    void		ShowSourcePosition(word addr);
	void		DisplayException(CMyException *pException);
	inline C8085Object * Get8085Object();
	virtual ~CMy8085View();
	void		ToggleBkPtAtAddress( word addr );
	inline void	StandardBeep( ) { MessageBeep( 0xFFFFFFFF ); }
	void		DisplayBreakpointList();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif
	virtual void DrawMargin(CDC *pdc, const CRect &rect, int nLineIndex);

// data members
protected:
    C8085Display *  m_p8085Display;
    int             m_nMargin;
    BOOL            m_bLEDButtonState;
	BOOL			m_bShortHelpOnStatusBar;
    // draws a green triangle against the source line during debugging
    CGreenTriangle  m_cSrcArrow;   

	// remember the debug dialogs position
	WINDOWPLACEMENT*	m_8085_display_window_position;

// Generated message map functions
protected:
	//{{AFX_MSG(CMy8085View)
	afx_msg void OnButtonCompile();
	afx_msg void OnUpdateButtonCompile(CCmdUI* pCmdUI);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnCompileProgram();
	afx_msg void OnUpdateCompileProgram(CCmdUI* pCmdUI);
	afx_msg void OnButtonShowAddress();
	afx_msg void OnUpdateButtonShowAddress(CCmdUI* pCmdUI);
	afx_msg void OnAccelRun();
	afx_msg void OnUpdateAccelRun(CCmdUI* pCmdUI);
	afx_msg void OnAccelStepInto();
	afx_msg void OnAccelRuntoCursor();
	afx_msg void OnAccelStepover();
	afx_msg void OnDebugCompile();
	afx_msg void OnUpdateDebugCompile(CCmdUI* pCmdUI);
	afx_msg void OnDebugStepInto();
	afx_msg void OnUpdateDebugStepInto(CCmdUI* pCmdUI);
	afx_msg void OnDebugStepOver();
	afx_msg void OnUpdateDebugStepOver(CCmdUI* pCmdUI);
	afx_msg void OnDebugRun();
	afx_msg void OnUpdateDebugRun(CCmdUI* pCmdUI);
	afx_msg void OnDebugBreakpointsList();
	afx_msg void OnToggleBkpt();
	afx_msg void OnHelpHtmlDocumentation();
	afx_msg void OnAccelHelp();
	afx_msg void OnButtonHelp();
	afx_msg void OnHelpRegistrationinfo();
	afx_msg void OnEnableDisableBkpt();
	afx_msg void OnHelpSystemcalls();
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnAccelCloseSimulation();
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnMypopupMenuUndo();
	afx_msg void OnMypopupMenuSelectAll();
	afx_msg void OnMypopupMenuCut();
	afx_msg void OnMypopupMenuCopy();
	afx_msg void OnMypopupMenuPaste();
	afx_msg void OnMypopupMenuDelete();
	afx_msg void OnEditPreferences();
	afx_msg void OnButtonEditPreferences();
	afx_msg void OnDisplayBreakpointList();
	//}}AFX_MSG
	afx_msg void OnUpdateIndicatorPosition(CCmdUI* pCmdUI);
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in 8085View.cpp
inline CMy8085Doc* CMy8085View::GetDocument()
   { return (CMy8085Doc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.


#endif // !defined(AFX_8085VIEW_H__0769A9CE_7890_11D2_8060_00A0C91F41A7__INCLUDED_)
